//
//  LYEArtistCell.m
//  artist
//
//  Created by Jay_Apple on 16/3/3.
//  Copyright © 2016年 viviyoo. All rights reserved.
//

#import "LYEArtistCell.h"
#import "LYCollectListModel.h"


@interface LYEArtistCell ()

@property (weak, nonatomic) IBOutlet UIImageView *icon;

@property (weak, nonatomic) IBOutlet UILabel *peoples;
@property (weak, nonatomic) IBOutlet UILabel *title;
@property (weak, nonatomic) IBOutlet UILabel *price;

@property (weak, nonatomic) IBOutlet UILabel *adress;

@property (weak, nonatomic) IBOutlet UILabel *name;

@property (weak, nonatomic) IBOutlet UILabel *star;
@property (weak, nonatomic) IBOutlet UILabel *comment;

@end

@implementation LYEArtistCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

#pragma mark - 重写

- (void)setModel:(LYMyClassListModel *)model{

    _model = model;
    
    NSString *icon = [[_model.images componentsSeparatedByString:@","] firstObject];
    
    [self.icon sd_setImageWithURL:[NSURL URLWithString:icon] placeholderImage:[UIImage imageNamed:@"contacts_default_avatar"]];
    self.title.text = _model.title;
    self.name.text = _model.nick_name;
    
    switch (_model.status) {
        case classStatusExpire:
            self.peoples.text = @"课程已过期";
            break;
        
        case classStatusNotCheck:
            
        case classStatusNormal:
            self.peoples.text = [NSString stringWithFormat:@"已有%zd人报名",_model.pay_num];
            break;
            
         case classStatusClose:
            self.peoples.text = @"课程已关闭";
            break;
    }

    
    
    self.comment.text = [NSString stringWithFormat:@"评论%zd",_model.comment_num];
    self.star.text = [NSString stringWithFormat:@"%@分",_model.star];
    self.price.text = [NSString stringWithFormat:@"¥%@",_model.price];
    self.adress.text = _model.city;
}

@end
